package com.chinasoft.bigdatadisplay.service.impl;


import com.chinasoft.bigdatadisplay.entity.*;
import com.chinasoft.bigdatadisplay.mapper.ResultDisplayMapper;
import com.chinasoft.bigdatadisplay.result.Result;
import com.chinasoft.bigdatadisplay.service.ResultDisplayService;
import org.apache.xmlbeans.impl.xb.xsdschema.Attribute;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class ResultDisplayServiceImpl implements ResultDisplayService {

    @Autowired
    private ResultDisplayMapper resultDisplayMapper;


    @Override
    public AvgConsumptionOfLocation getAvgConsumptionOfLocation(String location) {
        return resultDisplayMapper.getAvgConsumptionOfLocation(location);
    }

    @Override
    public AvgConsumptionOfAge getAvgConsumptionOfAge(String age) {
        return resultDisplayMapper.getAvgConsumptionOfAge(age);
    }


    @Override
    public List<SumCategoryOfAge>  getSumCategoryOfAge(String age) {
        return resultDisplayMapper.getSumCategoryOfAge( age); // 将单个对象添加到列表中
    }

    @Override
    public List<BrandSalesStats> getBrandSalesStats() {
        return resultDisplayMapper.getBrandSalesStats();
    }

    @Override
    public List<CategorySalesStats> getCategorySalesStats() {
        return resultDisplayMapper.getCategorySalesStats();
    }

    @Override
    public List<GenderSalesSummary> getGenderSalesSummary() {
        return resultDisplayMapper.getGenderSalesSummary();
    }

    @Override
    public Result<List<MonthlySalesStats>> listAllSalesStats() {
        List<MonthlySalesStats> statsList = resultDisplayMapper.listAll();
        return Result.success(statsList);
    }

    @Override
    public List<UserPurchaseStats> getUserPurchaseStats() {
        return resultDisplayMapper.getUserPurchaseStats();
    }

}
    